/**
 * 创建合同
 * @param params
 */

import type { addRentParams, houseContract, UploadRent } from "@/types/rent"
import { request } from "@/utils/reuqest"

// 添加合同
export const addRentAPI = (params: addRentParams) => {
  return request('/park/enterprise/rent','POST',params)
}

/**
 * 上传合同文件
 */
export const UploadAPI = (fd: FormData) => {
  return request<UploadRent>('/upload','POST',fd)
}

/**
 * 获取企业下合同列表
 * @param {*} id
 * @returns
 */
export const getRentListAPI = (id:string) => {
  return request<houseContract[]>(`/park/enterprise/rent/${id}`,'GET')
}

/**
 * 退租合同
 * @param {合同id} rentId
 * @returns
 */
export const outRentAPI = (rentId: string) => {
  return request(`/park/enterprise/rent/${rentId}`,'PUT')
} 

/**
 * 删除合同
 * @param {合同id} rentId
 * @returns
 */
export const delRentAPI = (rentId: string) => {
  return request(`/park/enterprise/rent/${rentId}`,'DELETE')
}